package admindao

import (
	"wzgames/internal/gdao"
	"wzgames/internal/model/roulettep"
)

type RouDao gdao.DaoSource

const sqlGetRouRound = "select * from roulette_rounds where `rid`=? and `instid`=? limit 1"

func (dao *RouDao) GetRouRound(roundId, instId int64) (*roulettep.RouletteRoundEntity, error) {
	r := &roulettep.RouletteRoundEntity{}
	err := dao.Get(r, sqlGetRouRound, roundId, instId)
	return r, err
}

const sqlGetRouNodeRound = "select * from roubig_node_rounds where `nodeid`=? and `instid`=? and `roundid`=? limit 1"

func (dao *RouDao) GetRouNodeRound(nodeId, instId, roundId int64) (*roulettep.RouNodeRoundEntity, error) {
	r := &roulettep.RouNodeRoundEntity{}
	err := dao.Get(r, sqlGetRouNodeRound, nodeId, instId, roundId)
	return r, err
}
